#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>.
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLineEdit>
#include <QGridLayout>

#include "sessionFriendArea.h"
#include "debug.h"
#include "messageshowarea.h"
#include "messageEditArea.h"


class MainWidget : public QWidget
{
    Q_OBJECT


public:
    static MainWidget* getInstance();
    void initWindow();
    void initWindowLeft();
    void initWindowMid();
    void initWindowRight();

    void initSignalSlots();

    void loadSessionList();
    void loadFriendList();
    void loadApplyList();
private:
    MainWidget(QWidget *parent = nullptr);
    ~MainWidget();

public slots:
    void switchTabToSession();
    void switchTabToFriend();
    void switchTabToApply();

private:
    static MainWidget* _instance;
    QWidget *windowLeft;
    QWidget *windowMid;
    QWidget *windowRight;

    // windowLeft中内容
    QPushButton *userAvatarBtn;
    QPushButton *sessionTabBtn;
    QPushButton *friendTabBtn;
    QPushButton *applyTabBtn;

    enum ActiveTab {
        SESSION_LIST,
        FRIEND_LIST,
        APPLY_LIST
    };
    ActiveTab activeTab = SESSION_LIST;

    // windowMid中的内容
    QLineEdit *searchEdit;
    QPushButton *addFriendBtn;

    // windowRight中的内容
    QLabel *sessionLabel;
    QPushButton *extraBtn;

    MessageShowArea* messageShowArea;
    MessageEditArea* messageEditArea;

};
#endif // MAINWIDGET_H
